package buildcode.shop;

import buildcode.database.TableColumnInfo;
import buildcode.language.es.EsUtil;

public class ShopUtil {
    public static VueField buildField(TableColumnInfo column) {
        VueField vueField = new VueField(column.getCamelCaseName(), EsUtil.getEsTypeByJdbcType(column.getJdbcType()), "", column);
        vueField.setRemark(column.getNote());
        vueField.setFrameType("input");
        if (column.getCamelCaseName().contains("Time") || column.getCamelCaseName().contains("Date")) {
            vueField.setFrameType("datetimerange");
        }
        if (column.getNote() != null && column.getNote().matches(".*[0-9]+.*")) {
            vueField.setFrameType("select");
        }
        return vueField;
    }
}
